import 'osc_about_entity.dart';
import 'osc_author.dart';
import 'osc_image_entity.dart';
import 'osc_image_simple_entity.dart';
import 'osc_statistics.dart';

class OscProjectDetail {
	OscImageSimple image;
	List<OscImage> images;
	OscAuthor author;
	String body;
	String title;
	int type;
	String pubDate;
	List<String> tags;
	String h5Url;
	int newsId;
	OscProjectExtra extra;
	List<OscAbout> abouts;
	String href;
	int id;
	bool favorite;
	OscStatistics statistics;

	OscProjectDetail({this.image, this.images, this.author, this.body, this.title, this.type, this.pubDate, this.tags, this.h5Url, this.newsId, this.extra, this.abouts, this.href, this.id, this.favorite, this.statistics});

	OscProjectDetail.fromJson(Map<String, dynamic> json) {
		image = json['image'] != null ? new OscImageSimple.fromJson(json['image']) : null;
		if (json['images'] != null) {
			images = new List<OscImage>();(json['images'] as List).forEach((v) { images.add(new OscImage.fromJson(v)); });
		}
		author = json['author'] != null ? new OscAuthor.fromJson(json['author']) : null;
		body = json['body'];
		title = json['title'];
		type = json['type'];
		pubDate = json['pubDate'];
		tags = json['tags']?.cast<String>();
		h5Url = json['h5Url'];
		newsId = json['newsId'];
		extra = json['extra'] != null ? new OscProjectExtra.fromJson(json['extra']) : null;
		if (json['abouts'] != null) {
			abouts = new List<OscAbout>();(json['abouts'] as List).forEach((v) { abouts.add(new OscAbout.fromJson(v)); });
		}
		href = json['href'];
		id = json['id'];
		favorite = json['favorite'];
		statistics = json['statistics'] != null ? new OscStatistics.fromJson(json['statistics']) : null;
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		if (this.image != null) {
      data['image'] = this.image.toJson();
    }
		if (this.images != null) {
      data['images'] =  this.images.map((v) => v.toJson()).toList();
    }
		if (this.author != null) {
      data['author'] = this.author.toJson();
    }
		data['body'] = this.body;
		data['title'] = this.title;
		data['type'] = this.type;
		data['pubDate'] = this.pubDate;
		data['tags'] = this.tags;
		data['h5Url'] = this.h5Url;
		data['newsId'] = this.newsId;
		if (this.extra != null) {
      data['extra'] = this.extra.toJson();
    }
		if (this.abouts != null) {
      data['abouts'] =  this.abouts.map((v) => v.toJson()).toList();
    }
		data['href'] = this.href;
		data['id'] = this.id;
		data['favorite'] = this.favorite;
		if (this.statistics != null) {
      data['statistics'] = this.statistics.toJson();
    }
		return data;
	}
}


class OscProjectExtra {
	String softwareLicense;
	String softwareHomePage;
	String softwareScore;
	String softwareCollectionDate;
	String softwareName;
	String softwareDownload;
	String softwareSupportOS;
	String softwareTitle;
	String softwareStar;
	String softwareLanguage;
	String softwareIdentification;
	String softwareDocument;

	OscProjectExtra({this.softwareLicense, this.softwareHomePage, this.softwareScore, this.softwareCollectionDate, this.softwareName, this.softwareDownload, this.softwareSupportOS, this.softwareTitle, this.softwareStar, this.softwareLanguage, this.softwareIdentification, this.softwareDocument});

	OscProjectExtra.fromJson(Map<String, dynamic> json) {
		softwareLicense = json['softwareLicense'];
		softwareHomePage = json['softwareHomePage'];
		softwareScore = json['softwareScore'];
		softwareCollectionDate = json['softwareCollectionDate'];
		softwareName = json['softwareName'];
		softwareDownload = json['softwareDownload'];
		softwareSupportOS = json['softwareSupportOS'];
		softwareTitle = json['softwareTitle'];
		softwareStar = json['softwareStar'];
		softwareLanguage = json['softwareLanguage'];
		softwareIdentification = json['softwareIdentification'];
		softwareDocument = json['softwareDocument'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['softwareLicense'] = this.softwareLicense;
		data['softwareHomePage'] = this.softwareHomePage;
		data['softwareScore'] = this.softwareScore;
		data['softwareCollectionDate'] = this.softwareCollectionDate;
		data['softwareName'] = this.softwareName;
		data['softwareDownload'] = this.softwareDownload;
		data['softwareSupportOS'] = this.softwareSupportOS;
		data['softwareTitle'] = this.softwareTitle;
		data['softwareStar'] = this.softwareStar;
		data['softwareLanguage'] = this.softwareLanguage;
		data['softwareIdentification'] = this.softwareIdentification;
		data['softwareDocument'] = this.softwareDocument;
		return data;
	}
}

